package springweb.controller;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import springweb.form.SimplePersonForm;
import springweb.viewbean.SimplePersonViewBean;

public class ParamSubmitController extends SimpleFormController {

	public ParamSubmitController()
	{
		setCommandClass(SimplePersonForm.class);
		
	}
	
	protected ModelAndView onSubmit(Object command, BindException errors) throws Exception {
		System.out.println("ParamSubmitController :  onSubmit");
		SimplePersonForm form = (SimplePersonForm)command;
		SimplePersonViewBean resultView = 
				new SimplePersonViewBean(form.getFirstName() + " " + form.getLastName());
		return new ModelAndView("submittalresult", "resultView", resultView);
	}

}
